By Christian McDonald
Assistant Professor of Practice
School of Journalism
Moody College of Communication
University of Texas at Austin
This prepares Food Access data to join with spatial files to put in Tableau. We’re basically trying to make a version of this map, which you can build here.
food-atlas
The data file Food Access Research Atlas Data Download 2015 was downloaded from United States Department of Agriculture. It is saved as data-raw/DataDownload2015.xlsx. This has three tabs. I saved the tab Variables Lookup as it’s own file data-dictionary.xlsx for reference in a smaller file. There is documentation for the food access varialbles.
01-import imports the file from Excel, selects the columns we need and filters it to Travis County, Texas. There are 218 rows.
There is an export file data-processed/fa_travis.rds that is used in the next notebook.
02-data-wrangle does some data checking and creates columns that can more clearly show the food access level of each census tract.
There is an export file tfa.csv to use with QGIS , and tfa.rds to use with the next R notebook.
03-mapping maps the “Limited Access” and “Limited Income and Limited Access” columns using ggplot and tigris.
The qgis folder has a project food_access.qgz that has Travis Census tracts and joins with the data wrangled from 02-data-wrangle as data-processed/tfa.csv.
tl_2019_48_tracts/travis_tract.gpkg is the travis shapefile, filtered from the original, which is also available in the repo.data-processed/tfa.csv.travis_food_access shapefile called tfa.shp (and companion files). A compressed zip is also available.In the tableau folder is a workbook FoodDesert.twb that imports the tfa.shp file as a Spatial file and then creates the two interactive maps. I didn’t finish or publish that because it is the answer to a class assignment for a couple of students.
This Tableau help file was useful in dealing with the shapefiles. Of importance: add the Geoid to detial to split the individual tracts.
I started working on this project in R because I thought I would have to do a complicated reshape and filter to build the food access columns for “Limited Access” and “Limited Income Limited Access”, but once I figured out the logic of the columns I found I only needed two of them for our county, so a nested IF would suffice.
I tried later to go back to Workbench (the platform where I started this project) to do the IF, but I found their Excel formulas do not support the AND function, at least not within and IF.
I was able to build the columns in a Google sheet Food access formula. That file was started from the end of the “Import” sheet in the Workbench workbook. It wasn’t used … I just wanted to figure out the formula.
The folder csvkit has some earlier work to convert the Excel file to csv. It’s moot at this point, but I’m keeping it as a learning experience.